$(document).ready(function(){
    var bear = $("#logo")
    var oneBox = $("#one-box")
    var twoBox = $("#two-box")
    var threeBox = $("#three-box")
    var isHid = 1;

    var myDay = new Date()
    var myHour = myDay.getHours()
    
    if(myHour >= 0 && myHour <= 6){
        // 睡觉时间
        oneBox.html(impress1)

    }else if(myHour > 7 && myHour <= 11){
        // 早上好
        oneBox.html(impress2)

    }else if(myHour > 11 && myHour <= 14){
        // 中午
        oneBox.html(impress3)

    }else if(myHour > 14 && myHour <= 19){
        // 下午
        oneBox.html(impress4)

    }else if(myHour > 19 && myHour <= 24){
        // 晚上
        oneBox.html(impress5)
    }

    if(isHid == 1){
        oneBox.show()
        twoBox.hide()
        threeBox.hide()

    }
    
    bear.click(function(){
        if(isHid == 1){
            oneBox.hide()
            twoBox.show()
            isHid = 2
        }
        else if(isHid == 2){
            oneBox.show()
            twoBox.hide()
            isHid = 1
        }
        else if(isHid == 3){
            oneBox.hide()
            twoBox.show()
            threeBox.hide()
            isHid = 1

        }
    })

    var messageButton = $("#message-button")
    
    messageButton.click(function(){

        var messageText = $("#message-text").val()

        threeBox.show()
        twoBox.hide()
        isHid = 3

        
        if(messageText == ""){
            threeBox.html("你不和小熊说点什么嘛？<br/>快点我的头和我说话！")
        }else if(messageText != ""){
            threeBox.html("正在听你的消息哦！<br/>等一下下哈！")
            Email.send({
                Host : "smtp.qq.com", // 发件人所用邮箱的smtp服务器
                Username : "1942886312@qq.com",  // 发件人的用户名
                Password : "hewhcrdccqfucdad",  // 发件人所用邮箱开启smtp服务时的密码
                To : '201914649@qq.com',    // 收件人
                From : "1942886312@qq.com",   // 发件人
                Subject : "bear", // 邮件主题
                Body : "维NI提醒！</br>" +"你的小朋友刘可可正在叫你呢！</br></br>" + messageText // 邮件内容支持html标签
    
            }).then(
            //   message => alert(message)
                function(){
                    threeBox.html("收到啦！收到啦！<br/>点我的头还可以继续和我说哦！")
                }
            );
        }
        
        
        

        
        
        

        
        


    })
      
});
